<%@ include file="../system/HeaderStrutsForm.jsp" %>
<html>
  <head>

    <bean:message key="page.css"/>
    <bean:message key="page.script"/>
  </head>
  <center>
    <body>
      <table class="mainTable" style='width:99%;'>
        <tr>
          <td>
            <html:form 
                action="Geral/VerificaCepForm.do"
                method="POST"
                onsubmit="return confirmSubmit();"
                scope="session"
                styleClass="baseForm"
                target="_self">


              <table class="bannerTable" style='width:99%;'>
                <tr>
                  <td class=tableHeader>
                    Pesquisa
                  </td>
                </tr>
              </table>
              <table class="messageTable" style='width:99%;'>
                <tr>
                  <td class="messageHeader">
                    <bean:message key="div.campos*"/>
                    <html:errors/>
                  </td>
                </tr>
              </table>
              <table class="itemTable" style='width:99%;'>
                <html:hidden property="ceps_logradouro"/>
                <html:hidden property="ceps_cidade"/>
                <html:hidden property="ceps_bairro"/>
                <html:hidden property="bair_id"/>
                <html:hidden property="cida_id"/>
                <tr>
                  <script>
                    function preencherCep(ceps_id,ceps_numero,logr_descricao,bair_descricao,cida_descricao,unfd_descricao){
                      var o  = window.opener;

                      o.document.forms[0].<%=pageContext.getSession().getAttribute("cep")%>.value = ceps_id;
                      o.document.forms[0].<%=pageContext.getSession().getAttribute("cepLabel")%>.value = ceps_numero;
                      o.document.forms[0].<%=pageContext.getSession().getAttribute("logradouro")%>.value = logr_descricao;
                      o.document.forms[0].<%=pageContext.getSession().getAttribute("bairro")%>.value = bair_descricao;
                      o.document.forms[0].<%=pageContext.getSession().getAttribute("cidade")%>.value = cida_descricao;
                      o.document.forms[0].<%=pageContext.getSession().getAttribute("estado")%>.value = unfd_descricao;
                      window.close();
                    }
                  </script>
                </tr>



                <tr>
                  <td class="formLabel">
                    <span class="spamFormLabel" >
                      CEP
                    </span>
                  </td>
                  <td class="formField">
                    <html:text property="ceps_numero" styleClass="baseField"/>
                  </td>
                </tr>
                <tr>
                  <td class="formLabel">
                    <span class="spamFormLabel" >
                      Cidade
                    </span>
                  </td>
                  <td class="formField">
                    <html:text 
                        property="cida_descricao"
                        onkeydown="javascript:toUpperCase(this);"
                        styleClass="baseField"
                        size="50"
                        maxlength="100"/>
                  </td>
                </tr>
                <tr>
                  <td class="formLabel">
                    <span class="spamFormLabel" >
                      Bairro
                    </span>
                  </td>
                  <td class="formField">
                    <html:text 
                        property="bair_descricao"
                        onkeydown="javascript:toUpperCase(this);"
                        styleClass="baseField"
                        size="50"
                        maxlength="100"/>
                  </td>
                </tr>
                <tr>
                  <td class="formLabel">
                    <span class="spamFormLabel" >
                      Logradouro
                    </span>
                  </td>
                  <td class="formField">
                    <html:text 
                        property="logr_descricao"
                        styleClass="baseField"
                        size="75"
                        maxlength="150"/>
                  </td>
                </tr>
                <tr>
                  <td class="formLabel">
                    <span class="spamFormLabel" >
                      Lista de Ceps no banco
                    </span>
                  </td>
                  <td class="formField">
                    <display:table 
                        name="ceps"
                        scope="session"
                        class="displayTag"
                        pagesize="16"
                        decorator="br.com.werp.regras.endereco.visao.decorador.CepLov">


                      <display:column property="ceps_numero"    title="CEP" />
                      <display:column 
                          property="logr_tipo"


                           title="Tipo Logr"
                      />
                      <display:column 
                          property="logr_descricao"
                          title="Logradouro"
                      />
                      <display:column 
                          property="bair_descricao"
                          title="Bairro"
                      />
                      <display:column 
                          property="cida_descricao"
                          title="Cidade"
                      />
                      <display:column 
                          property="unfd_descricao"
                          title="Estado"
                      />
                    </display:table>
                  </td>
                </tr>
              </table>
              <table class="buttonTable" style='width:99%;'>
                <tr>
                  <td class="buttonItem">
                    <html:submit 
                        value="Pesquisar"
                        styleClass="baseButton"
                        property="pesquisar_action">


                    </html:submit>
                    <html:submit 
                        accesskey="r"
                        styleClass="baseButton"
                        property="resetfull_action">


                      <bean:message 
                          bundle="ApplicationResources"
                          key="jsp.reset"/>
                    </html:submit>
                    <html:button 
                        accesskey="c"
                        onclick="javascript:window.close();"
                        styleClass="baseButton"
                        property="close_action">


                      <bean:message 
                          bundle="ApplicationResources"
                          key="jsp.close"/>
                    </html:button>
                    <html:submit 
                        value="verifica_ajax"
                        style=" visibility: hidden; "
                        styleClass="baseButton"
                        property="verifica_ajax_action">


                    </html:submit>
                    <html:submit 
                        value="carregar"
                        style=" visibility: hidden; "
                        styleClass="baseButton"
                        property="carregar_action">


                    </html:submit>
                    <html:submit 
                        value="popup"
                        style=" visibility: hidden; "
                        styleClass="baseButton"
                        property="popup_action">


                    </html:submit>
                  </td>
                </tr>
              </table>
            </html:form>

          </td>
        </tr>
      </table>
    </body>
  </center>
</html>
